import { requestClient as request } from '../request'

// 获取入库单列表
export function getMstockinList(params: any) {
  return request.get('/admin/Mstockin/index', params)
}

// 获取入库单详情
export function getMstockinInfo(params: any) {
  return request.get('/admin/Mstockin/edit', params)
}

// 新增入库单
export function doMstockinAdd(data: any) {
  return request.post('/admin/Mstockin/add', data)
}

// 编辑入库单
export function doMstockinEdit(data: any) {
  return request.post('/admin/Mstockin/edit', data)
}

// 删除入库单
export function doMstockinDelete(data: any) {
  return request.post('/admin/Mstockin/del', data)
}

// 审核入库单
export function AuditMstockIn(params: any) {
  return request.post('admin/mstockin/mstockin_audit', params)
}

// 反审入库单
export function ReverseMstockIn(params: any) {
  return request.post('admin/mstockin/mstockin_audit_reverse', params)
}

// 获取生产制单商品
export function getPlanGoods(params: any) {
  return request.post('admin/mstockin/get_plan_goods', params)
}

// 导出列表
export function daochuList(params: any) {
  return request.post('admin/mstockin/daochu', params)
}

// 导出明细
export function daochuDetail(params: any) {
  return request.post('admin/mstockin/daochu_detail', params, {
    // responseType: 'blob',
  })
}

// 获取生产制单列表
export function getPlanList(params: any) {
  return request.post('admin/mstockin/get_plan_list', params)
}

// 批量导入入库单
export function batchImportStockin(formData: FormData) {
  return request.post('admin/mstockin/batchImportStockin', formData, {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })
}

// 获取工序列表
export function getProcessList(params: any) {
  return request.get('/admin/process/index', params)
}

/**
 * 获取仓库列表的函数（需要在API中添加）
 */
export function getWarehouseList(params: any) {
  return request.post('admin/Mstockin/get_warehouse_list', params)
}

/**
 * 获取供应商列表的函数（需要在API中添加）
 */
export function getSupplyList(params: any) {
  return request.post('admin/Mstockin/get_supply_list', params)
}
